<?php
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/frontend/js/jquery.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerCssFile($this->staticsPath."/css/global.css");
Yii::app()->clientScript->registerCssFile($this->staticsPath."/css/index.css");
Yii::app()->clientScript->registerCssFile($this->staticsPath."/css/font-awesome.min.css");
Yii::app()->clientScript->registerCssFile($this->staticsPath."/Font-Awesome-3.2.1/css/font-awesome.min.css");

Yii::app()->clientScript->registerCss("CSS1","
    .cont_box img{
        height: 200px;
    }

   #loadings {
        left: 50%;
        position: absolute;
        top: 50%;
    }

");


?>
<style type="text/css">
    .main-box {
                height: 100%;
        left: 0;
        margin: 0 auto;
        position: absolute;
        top: 0;
        width: 100%;
        z-index: -1;
    }
    .morcon {
        height: 100px;
        margin: 245px 20px 20px;
        position: relative;
        text-align: center;
    }

    .morcon .reg {
        background: rgba(255, 255, 255, 0) none repeat scroll 0 0;
        border: medium none;
        color: #fff;
        font-size: 20px;
        left: 4%;
        position: absolute;
        top: 0;
    }
    .morcon .login {
        background: rgba(255, 255, 255, 0) none repeat scroll 0 0;
        border: medium none;
        color: #fff;
        display: block;
        font-size: 20px;
        left: 51%;
        position: absolute;
        top: 39%;
    }

    .wrap .header{
        width: 100%;
        position: relative;
        height: 300px;
    }
    .wrap .footer {
        height: 300px;
        position: relative;
        width: 100%;
    }

    .wrap .header .mydodo{
        background: url("<?php echo $this->staticsPath."/img/mydodo.png" ?>") no-repeat scroll 0 0 / 150px auto;
        height: 40px;
        width: 150px;
        position: absolute;
        right: 15px;
        top: 25px;
    }
    .wrap .header .imgbg{
        background: url("<?php echo $this->staticsPath."/img/imgbg.png" ?>") no-repeat scroll 0 0 / 150px auto;
        height: 150px;
        width: 150px;
        position: absolute;
        left: 15px;
        top: 90px;
    }
    .imgbg .box{
        width: 100%;
        height: 100%;
        position: relative;
    }
    .imgbg .box img {
        border-radius: 50%;
        height: 80%;
        left: 15px;
        position: absolute;
        top: 15px;
        width: 80%;
    }
    .wrap .header .hname {
        height: 200px;
        left: 170px;
        position: absolute;
        top: 144px;
        width: 200px;
    }
    .wrap .header .hname p{
        color: #0066b3;
        font-size: 20px;
    }
    .wrap .header .list {


        height: 80px;
        left: 25px;
        position: absolute;
        top: 25px;
        width: 80px;
    }
    .wrap .header .list a{
        color: #0066b3;
        font-size: 30px;
    }


    body{
        background: #FDF2B9 url("<?php echo $this->staticsPath."/img/mypoint.png" ?>") no-repeat scroll 0 0 / 100% auto;
        background-attachment: fixed;
        background-size:cover
    }
    .header {
        position: fixed;
        top:0;
    }
    html,
    body,
    .data,
    .wrap {
        height: 100%;
    }

    .borders{
        width: 100%;
        position: relative;
        height: auto;
    }
    .borders .bg{
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: -1;
        border: 0;
    }
    .borders .tx{
        width: 30px;
        height: auto;
    }
    .borders .content {
        color: #555;
        font-size: 12px;
        padding: 11% 10px 15% 18%;
    }
    .borders .ptx{
        margin-top: 5px;
    }




    .imgbg .box{
        width: 100%;
        height: 100%;
        position: relative;
    }
    .imgbg .box img {
        border-radius: 50%;
        height: 80%;
        left: 15px;
        position: absolute;
        top: 15px;
        width: 80%;
    }
    .wrap .header_box{
        height: 260px;
    }
    .wrap .header_box .imgbg{

        height: 150px;
        width: 150px;
        position: absolute;
        left: 15px;
        top: 90px;
    }
    .wrap .header_box .hname {
        height: 200px;
        left: 170px;
        position: absolute;
        top: 90px;
        width: 140px;
    }
    .wrap .header_box .hname p{
        color: #0066b3;
        font-size: 20px;
    }
    .wrap .header_box .list {


        height: 80px;
        left: 25px;
        position: absolute;
        top: 25px;
        width: 80px;
    }
    .wrap .header_box .list a{
        color: #0066b3;
        font-size: 30px;
    }
    .imgbox{
        padding: 25px;
    }
    .imgbox .box{
        float: left;
        width: 49%;
        height: 150px;
        position: relative;
    }
    .imgbox .box .list_box{

        height: 100%;
        width: 100%;
    }
    .imgbox .box .point1{
        background: url("<?php echo $this->staticsPath."/img/point1.png" ?>") no-repeat scroll 13px 0 / 130px auto;
        padding-left: 60px;
        padding-top: 66px;
    }
    .imgbox .box .point2{
        padding-left: 60px;
        padding-top: 42px;
        background: url("<?php echo $this->staticsPath."/img/point2.png" ?>") no-repeat scroll 13px 0 / 130px auto;
    }
    .imgbox .box .point3{
        padding-left: 60px;
        padding-top: 42px;
        background: url("<?php echo $this->staticsPath."/img/point3.png" ?>") no-repeat scroll 13px 0 / 130px auto;
    }
    .imgbox .box .point4{
        padding-left: 60px;
        padding-top: 60px;
        background: url("<?php echo $this->staticsPath."/img/point4.png" ?>") no-repeat scroll 13px 0 / 130px auto;
    }
    .imgbox .box .point5{
        padding-left: 60px;
        padding-top: 42px;
        background: url("<?php echo $this->staticsPath."/img/point5.png" ?>") no-repeat scroll 13px 0 / 130px auto;
    }
    .imgbox .box .point6{
        padding-left: 50px;
        padding-top: 30px;
        background: url("<?php echo $this->staticsPath."/img/point6.png" ?>") no-repeat scroll 13px 0 / 130px auto;
    }
    #loading {
        font-size: 30px;
        height: 50px;
        margin: 0 auto;
        text-align: center;
        width: 100px;
    }
    .alert-error {
        color: #b94a48;
    }
    .alert {
        border-radius: 4px;
        margin-bottom: 20px;
        padding: 8px 35px 8px 14px;
        text-align: center;
        text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
    }
</style>

<div class="data" >
    <header class="homeHder header">
        <a href="<?php echo $this->createUrl('index',array('openid'=>$openid)) ?>">
        <div class="hder_return flol">

                <i class="size fa fa-angle-left"></i>

        </div>
        </a>
        <div class="hder_logo">我的积分</div>
    </header>
    <section class="wrap">
        <div class="header_box">
            <div id="imgbg" class="imgbg">
                <div class="box">
                    <?php if($user_info->image){ ?>
                        <img src="<?php echo $user_info->image ?>">
                    <?php }else{ ?>
                        <?php if($user_info->sex ==1){ ?>
                            <img src="<?php echo $this->staticsPath."/img/tx1.jpg" ?>">
                        <?php }else{ ?>
                            <img src="<?php echo $this->staticsPath."/img/tx2.jpg" ?>">
                        <?php } ?>
                    <?php } ?>
                    <p style="color: rgb(255, 255, 255); font-size: 22px; text-align: center; padding-top: 135px;"><?php echo $user_info->user_name ?></p>
                </div>
            </div>
            <div class="hname">
                <p style="color: rgb(255, 255, 255); text-align: center; font-size: 55px; margin-top: 45px; margin-bottom: 25px;"><b ><?php echo $user_info->point ?></b></p>
                <p style="color: rgb(255, 255, 255); text-align: center;font-size: 22px;">总积分</p>
            </div>
        </div>
        <div class="content_box">
            <ul id="min" class="imgbox clearfix">
                <?php if($list){ ?>
                <?php foreach($list as $v){ ?>
                    <?php if($v['title']=='心得分享'){ ?>
                            <li class="box item">
                                <span style="position: absolute; top: 20px; font-size: 20px; font-weight: 900; left: 125px; color: #c92615;">+<?php echo $v['num'] ?></span>
                                <div class="list_box point1">
                                    <span style="width: 40px; display: block; color: rgb(255, 255, 255); font-weight: 900; font-size: 18px; height: 50px;">心得分享</span>
                                </div>
                            </li>
                    <?php }elseif($v['title']=='读书签到'){ ?>
                            <li class="box item">
                                <span style="position: absolute; top: 20px; font-size: 20px; font-weight: 900; left: 90px; color: yellow;">+<?php echo $v['num'] ?></span>
                                <div class="list_box point2">
                                    <span style="width: 40px; display: block; color: #1e7b9a; font-weight: 900; font-size: 18px; height: 50px;">读书签到</span>
                                </div>
                            </li>
                    <?php }elseif($v['title']=='教师评价'){ ?>
                            <li class="box item">
                                <span style="position: absolute; top: 20px; font-size: 20px; font-weight: 900; left: 90px; color: yellow;">+<?php echo $v['num'] ?></span>
                                <div class="list_box point3">
                                    <span style="width: 40px; display: block; color: rgb(255, 255, 255); font-weight: 900; font-size: 18px; height: 50px;">教师评价</span>
                                </div>
                            </li>

                    <?php }elseif($v['title']=='家长评价'){ ?>
                            <li class="box item">
                                <span style="position: absolute; top: 20px; font-size: 20px; font-weight: 900; left: 100px; color: #059e44;">+<?php echo $v['num'] ?></span>
                                <div class="list_box point4">
                                    <span style="width: 40px; display: block; color: rgb(255, 255, 255); font-weight: 900; font-size: 18px; height: 50px;">家长评价</span>
                                </div>
                            </li>
                    <?php }elseif($v['title']=='同学评价'){ ?>
                            <li class="box item">
                                <span style="position: absolute; top: 20px; font-size: 20px; font-weight: 900; left: 100px; color: #c92615;">+<?php echo $v['num'] ?></span>
                                <div class="list_box point5">
                                    <span style="width: 40px; display: block; color: rgb(255, 255, 255); font-weight: 900; font-size: 18px; height: 50px;">同学评价</span>
                                </div>
                            </li>
                    <?php }else{ ?>
                        <li class="box item">
                            <span style="position: absolute; font-size: 20px; font-weight: 900; color: rgb(201, 38, 21); left: 116px; top: 0px;"><?php if($v['type']==1){ ?>+<?php }else{ ?>-<?php } ?><?php echo $v['num'] ?></span>
                            <div class="list_box point6">
                                <span style="display: block; font-weight: 900; font-size: 18px; height: 50px; width: 75px; color: rgb(201, 38, 21);"><?php echo $v['title'] ?></span>
                            </div>
                        </li>
                    <?php } ?>
                <?php } ?>
                <?php } ?>







            </ul>
        </div>

    </section>
</div>


<div id="loading" style="display: none"><i class="fa fa-spinner fa-spin"></i></div>
<div id="alt" style="display: none;margin-top:50px;" class="alert alert-error">
    已经到底啦！
</div>

<script type="text/javascript">
    $(function(){
        var currentPage = 0;
        var isloading = false;
        $(window).scroll(function(){
            if($(window).scrollTop() + 100 >= $(document).height() - $(window).height()){
                if (isloading == true){  //如果loading为真 则return false;
                    return false;
                }
                currentPage = currentPage + 1;
                isloading = true; //为真了
                $.ajax({
                    url:'<?php echo $this->createUrl('ajaxPointList',array('openid'=>$openid)) ?>',
                    type : 'GET',
                    data:{
                        page:currentPage
                    },
                    dataType:'html',
                    beforeSend : function() {
                        $('#loading').show();
                        isloading = true;
                    },
                    success : function (data,response,status) {
                        if(data){
                            $('#min').append(data);
                            isloading = false;
                            $('#loading').hide();
                        }else{
                            isloading = true;
                            $('#loading').hide();
                            $('#alt').show();
                        }
                    }
                });
            }
        });
    });
</script>